<script>
    $(function(){
        //发表回复
        $("#scCommentBtn").click(function () {
            if (!$("#commentContent").val()) {
                alert("评论不能为空");
                return;
            }
            $("#scCommentForm").ajaxSubmit(function (data) {
                $("#commentContent").val("");
                $("#commentContent").attr("placeholder", "");

                $('#scCommentAdd').append(data);
            });
        });
    });
</script>
<div class="rev-list">
    <ul>
    <#list (page.content)! as p>
        <li class="rev-item comment-item clearfix _j_reply_list">
            <div class="user">
                <a class="avatar" href="/u/52068941.html" target="_blank">
                <img src="${(p.headUrl)!}" width="48" height="48">
                </a>
                <span class="level">LV.${(p.level)!}</span>
            </div>
            <a class="useful" data-id="191407415" title="点赞">
                <i></i><span class="useful-num">1</span>
            </a>
            <a class="name" href="#" target="_blank">${(p.username)!}</a>
            <span class="s-star s-star${(p.rank)!}"></span>
            <p class="rev-txt">${(p.content)!}</p>
            <div class="rev-img">
                <a href="#">
                    <img src="${(p.imgUrls)!}" width="500" height="300">
                </a>
            </div>
            <div class="info clearfix">
                <a class="btn-comment _j_comment" title="添加评论"></a>
                <span class="time">${(p.createTime?string('yyyy.MM.dd HH:mm:ss'))!}</span>
                <#--<span class="from">
                    此条点评来自游记<a href="/i/12601474.html" target="_blank">《南国花城正月中 ——2019年春节广州记（含长...》</a>
                </span>-->
            </div>
            <div style="margin-left: 120px;" id="scCommentAdd">
                <#list pageAll.content! as c >
                <#if (c.refComment.id ==p.id)!>
                    <div class="user">
                        <a class="avatar" href="#" target="_blank">
                            <img src="${(c.headImg)!}" width="48" height="48">
                        </a>
                        <span class="level">LV.${(c.level)!}</span>
                    </div>
                    <a class="name" href="#" target="_blank">${(c.username)!}</a>
                    <p class="rev-txt">${(c.content)!}</p>
                    <div class="info clearfix">
                        <span class="time">回复时间:${(c.createTime?string('yyyy.MM.dd HH:mm:ss'))!}</span>
                    </div>
                </#if>
                </#list>
            </div>
            <form action="/scenicSpotComment/commentAdd" method="post" id="scCommentForm">
                <input type="hidden" name="scenicId" id="scenicId" value="${(p.scenicId)!}">
                <input type="hidden" name="type" value="1" id="commentType">
                <input type="hidden" name="refComment.id" id="refCommentId" value="${(p.id)!}">


                <textarea class="_j_replyarea" name="content" cols="100" rows="5"
                          id="commentContent"
                          placeholder="说说你当前的想法吧">
                </textarea>

            </form>

            </div>
        </li>
    <div class="reply-submit">
        <!-- 有loading状态 -->
        <a role="button" style="margin-left: 800px" class="_j_publish_reply " id="scCommentBtn" title="发表回复">发表回复</a>
    </div>
    </#list>
    </ul>
</div>
<div style="float: right">
    <div style="float: left;" ><span style="line-height:30px"> 共${page.totalPages!}页 / ${page.totalElements}条&nbsp;&nbsp;&nbsp;</span></div>
    <div id="pagination" class="jq-pagination" style="display: inline;"></div>
</div>
<script>
    $("#pagination").jqPaginator({
                totalPages: ${page.totalPages!0},
                visiblePages: 5,
                currentPage: ${page.number+1}||1,
            prev: '<a class="prev" href="javascript:void(0);">上一页<\/a>',
            next: '<a class="next" href="javascript:void(0);">下一页<\/a>',
            page: '<a href="javascript:void(0);">{{page}}<\/a>',
            last: '<a class="last" href="javascript:void(0);" >尾页<\/a>',
            onPageChange: function(page, type) {
        if(type == 'change'){
            $("#currentPage").val(page);
            $("#searchForm").submit();
        }

    }
    })
</script>
